<template>
  <div class="top">
    <div class="top_left">
      <span class="btn"><a href="/">首页</a></span>
    </div>
    <div class="top_center">
      <div class="title">
        <span>{{ setting.title.substring(0, 9) }}</span>
        可视化大数据平台
      </div>
    </div>
    <div class="top_right">
      <span class="btn">统计报告</span>
      <span class="time">
        当前时间:
        {{ times }}
      </span>
    </div>
  </div>
</template>

<script lang="ts" setup name="index">
import setting from '@/setting'
import moment from 'moment'
import { onBeforeUnmount, onMounted, ref } from 'vue'
let times = ref(moment().format('YYYY年MM月DD日 hh:mm:ss'))
let timer = ref()
onMounted(() => {
  timer.value = setInterval(() => {
    times.value = moment().format('YYYY年MM月DD日 hh:mm:ss')
  }, 999)
})
//清除定时器
onBeforeUnmount(() => {
  clearInterval(timer.value)
})
</script>
<style scoped lang="scss">
.top {
  width: 100%;
  height: 50px;
  display: flex;
  color: aqua;
  text-align: center;
  a {
    text-decoration: none;
    color: aqua;
  }
  .top_left {
    flex: 1.5;
    background: url('../../images/dataScreen-header-left-bg.png') no-repeat;
    background-size: 100% 100%;
    .btn {
      float: right;
      background: url('../../images/dataScreen-header-btn-bg-l.png') no-repeat;
      font-size: 25px;
      background-size: 100% 100%;
      height: 50px;
      line-height: 50px;
      width: 180px;
      text-align: center;
    }
  }
  .top_center {
    flex: 2;
    background-color: rgb(92, 92, 92);
    height: 100px;
    background: url('../../images/dataScreen-header-center-bg.png') no-repeat;
    background-size: 100% 100%;
    .title {
      height: 100px;
      line-height: 80px;
      font-size: 40px;
    }
  }
  .top_right {
    flex: 1.5;
    background: url('../../images/dataScreen-header-right-bg.png') no-repeat;
    background-size: 100% 100%;
    .btn {
      float: left;
      background: url('../../images/dataScreen-header-btn-bg-r.png') no-repeat;
      font-size: 25px;
      background-size: 100% 100%;
      height: 50px;
      line-height: 50px;
      width: 180px;
      text-align: center;
    }
    .time {
      line-height: 50px;
      width: 100%;
      overflow: hidden;
    }
  }
}
</style>
